﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Mvc;
using KM.BUS;
using KM.ENT;

namespace KM.Areas.Admin.Controllers
{
    public class GroupNewController : Controller
    {
        //
        // GET: /Admin/GroupNew/

        public ActionResult DanhSach()
        {
            busGroupNews busGN = new busGroupNews();
            List<entGroupNews> lst = new List<entGroupNews>();
            lst = busGN.getAll();
            return View(lst);
        }
        public ActionResult Edit(int? Id)
        {
            busGroupNews busGN = new busGroupNews();
            List<entGroupNews> lst = new List<entGroupNews>();
            lst = busGN.getAll();
            ViewBag.lstGN = lst;
            entGroupNews entGN = new entGroupNews();
            if (Id != null)
            {
                entGN = busGN.getInfo(Id.Value);
            }
            return View(entGN);
        }
        [HttpPost]
        public ActionResult Edit(entGroupNews entGN)
        {
            busGroupNews busGN = new busGroupNews();
            busGN.createEdit(entGN);

            return RedirectToAction("danhsach");
        }
        public ActionResult delete(int Id)
        {
            busGroupNews busGN = new busGroupNews();
            busGN.delete(Id);
            return RedirectToAction("DanhSach");
        }
    }
}
